package io.qiezi.scala.drink

object App {
  def exchange(bottles: Int, caps: Int): Int = {
    val count = bottles / 3 + caps / 5
    if (count == 0) {
      return 0
    }

    val newBottles = count + bottles % 3
    val newCaps = count + caps % 5

    println(s"exchange number: $count , then has $newBottles bottles and $newCaps caps")

    count + exchange(newBottles, newCaps)
  }

  def main(args: Array[String]): Unit = {
    val result = 50 + exchange(50, 50)
    println(s"total number: $result")
  }
}
